package com.salt.admin.api.feign.client;

import com.salt.admin.api.feign.hystrix.OfficeClientHystrix;
import com.salt.admin.api.feign.interceptor.FeignTokenInterceptor;
import com.salt.admin.api.model.Office;
import com.salt.common.constant.Common;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Description
 * @Author salt
 * @Date 2020/6/18 10:43
 * @Version 1.0
 */
@FeignClient(name = Common.Service.SALT_ADMIN_SERVICE_NAME,
        path = Common.Service.SALT_ADMIN_OFFICE_URL_PREFIX,
        fallbackFactory = OfficeClientHystrix.class,
        configuration = FeignTokenInterceptor.class)
public interface OfficeClient {

    @PostMapping("getById")
    public Office get(@RequestParam("id") String id);

    @PostMapping("name")
    public Office getByOfficeName(@RequestParam("name") String name);

    @PostMapping("getChildren")
    public List<Office> getChildren(@RequestParam("parentId") String parentId);

    @PostMapping("getUserableChildren")
    public List<Office> getUserableChildren(@RequestParam("parentId") String parentId);

    @PostMapping("findList")
    public List<Office> findList(Office office);

    @PostMapping("findAllList")
    public List<Office> findAllList(Office office);

    @PostMapping("treeDataIds")
    public List<String> treeDataIds(@RequestParam("id") String id);

    @PostMapping("treeData")
    public List<Office> treeData(@RequestParam("id") String id);

    @PostMapping("findByIds")
    public List<Office> findByIds(@RequestParam("ids") List<String> ids);

}
